/**
 * 根据索引查询数据
 * @param {*} db 
 * @param {*} storeName 
 * @param {*} indexName 
 * @param {*} indexValue 
 * @returns 
 */
export function getDataByIndex(db, storeName, indexName, indexValue) {
  return new Promise((resolve, reject) => {
    const store = db.transaction(storeName, "readwrite").objectStore(storeName);
    const request = store.index(indexName).get(indexValue);
    request.onerror = function (event) {
        reject(event)
    };
    request.onsuccess = function (e) {
        var result = e.target.result;
        resolve(result);
    };
  });
}
